<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/Blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/Blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/Blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/Blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/Blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/Blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/Blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="vue," />










<meta name="description" content="vue 中对图片的处理 工作上接触了一下图片的处理，图片的格式是文件流, 记录如下。  请求图片请求图片的时候，带上{ responseType: &#39;blob&#39; }, 否则图片显示的可能是乱码。 12345678axios  .post(url, parmas, &amp;#123; responseType: &quot;blob&quot; &amp;#125;)  .then((res) &#x3D;&gt; &amp;#123">
<meta property="og:type" content="article">
<meta property="og:title" content="记一次对图片的处理">
<meta property="og:url" content="https://jingping-ye.github.io/Blog/2019/01/14/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9%E5%9B%BE%E7%89%87%E7%9A%84%E5%A4%84%E7%90%86/index.html">
<meta property="og:site_name" content="jingping.ye">
<meta property="og:description" content="vue 中对图片的处理 工作上接触了一下图片的处理，图片的格式是文件流, 记录如下。  请求图片请求图片的时候，带上{ responseType: &#39;blob&#39; }, 否则图片显示的可能是乱码。 12345678axios  .post(url, parmas, &amp;#123; responseType: &quot;blob&quot; &amp;#125;)  .then((res) &#x3D;&gt; &amp;#123">
<meta property="og:image" content="http://ytju2r.coding-pages.com/%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD%E5%89%8D.png">
<meta property="og:image" content="http://ytju2r.coding-pages.com/%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD%E5%90%8E.png">
<meta property="article:published_time" content="2019-01-14T01:15:33.000Z">
<meta property="article:modified_time" content="2020-05-14T05:34:55.228Z">
<meta property="article:author" content="jingping.ye">
<meta property="article:tag" content="vue">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://ytju2r.coding-pages.com/%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD%E5%89%8D.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/Blog/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://jingping-ye.github.io/Blog/2019/01/14/记一次对图片的处理/"/>





  <title>记一次对图片的处理 | jingping.ye</title>
  








<meta name="generator" content="Hexo 4.2.0"></head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/Blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">jingping.ye</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">jingping.ye的Blog</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/Blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/Blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/Blog/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/Blog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://jingping-ye.github.io/Blog/Blog/2019/01/14/%E8%AE%B0%E4%B8%80%E6%AC%A1%E5%AF%B9%E5%9B%BE%E7%89%87%E7%9A%84%E5%A4%84%E7%90%86/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="jingping.ye">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/Blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="jingping.ye">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">记一次对图片的处理</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-01-14T09:15:33+08:00">
                2019-01-14
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-check-o"></i>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2020-05-14T13:34:55+08:00">
                2020-05-14
              </time>
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/Blog/categories/%E6%8A%80%E6%9C%AF/" itemprop="url" rel="index">
                    <span itemprop="name">技术</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/Blog/categories/%E6%8A%80%E6%9C%AF/%E5%89%8D%E7%AB%AF/" itemprop="url" rel="index">
                    <span itemprop="name">前端</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  1.7k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  8
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="vue-中对图片的处理"><a href="#vue-中对图片的处理" class="headerlink" title="vue 中对图片的处理"></a>vue 中对图片的处理</h1><blockquote>
<p>工作上接触了一下图片的处理，图片的格式是文件流, 记录如下。</p>
</blockquote>
<h2 id="请求图片"><a href="#请求图片" class="headerlink" title="请求图片"></a>请求图片</h2><p>请求图片的时候，带上<code>{ responseType: &#39;blob&#39; }</code>, 否则图片显示的可能是乱码。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">axios</span><br><span class="line">  .post(url, parmas, &#123; <span class="attr">responseType</span>: <span class="string">"blob"</span> &#125;)</span><br><span class="line">  .then(<span class="function">(<span class="params">res</span>) =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="built_in">Promise</span>.resolve(res);</span><br><span class="line">  &#125;)</span><br><span class="line">  .catch(<span class="function">(<span class="params">e</span>) =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="built_in">Promise</span>.reject(e);</span><br><span class="line">  &#125;);</span><br></pre></td></tr></table></figure>

<h2 id="显示图片"><a href="#显示图片" class="headerlink" title="显示图片"></a>显示图片</h2><p>图片返回的是文件流的形式, 控制台中显示的是乱码。<br>直接显示二进制图片会出错，所以我们要进行处理。</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- template中 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">img</span> <span class="attr">alt</span>=<span class="string">"logo"</span> <span class="attr">:src</span>=<span class="string">"imageUrl"</span> @<span class="attr">error</span>=<span class="string">"handleLoadError"</span> /&gt;</span></span><br></pre></td></tr></table></figure>

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*------ script中------*/</span></span><br><span class="line"><span class="keyword">let</span> urlCreator = <span class="built_in">window</span>.URL || <span class="built_in">window</span>.webkitURL;</span><br><span class="line"><span class="keyword">let</span> imageUrl = urlCreator.createObjectURL(res);</span><br><span class="line"><span class="keyword">this</span>.imageUrl = imageUrl;</span><br></pre></td></tr></table></figure>

<p>显示图片中，要对万一图片显示不出来的情况进行处理。使用<code>onerror</code>事件可以对加载图片失败的情况进行处理。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">handleLoadError(e) &#123;</span><br><span class="line">  <span class="keyword">const</span> img = e.srcElement;</span><br><span class="line">  <span class="keyword">this</span>.imageUrl = <span class="keyword">this</span>.errorLoadImg;  <span class="comment">//  用加载失败的图片替代之</span></span><br><span class="line">  img.onerror = <span class="literal">null</span>; <span class="comment">//  清除错误:如果错误时加载时显示的图片出错，将会一直循环，所以我们必须清除掉错误，限制运行一次</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="上传图片-使用-element-ui-的-el-upload"><a href="#上传图片-使用-element-ui-的-el-upload" class="headerlink" title="上传图片:使用 element-ui 的 el-upload"></a>上传图片:使用 element-ui 的 el-upload</h2><h3 id="自动上传，一次传一张图片"><a href="#自动上传，一次传一张图片" class="headerlink" title="自动上传，一次传一张图片"></a>自动上传，一次传一张图片</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">el-upload</span></span></span><br><span class="line"><span class="tag">  <span class="attr">action</span>=<span class="string">"uploadUrl"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:show-file-list</span>=<span class="string">"false"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:accept</span>=<span class="string">"'image/*'"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:headers</span>=<span class="string">"&#123;token:$cookieStorage.token&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-success</span>=<span class="string">"handleSuccess"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-error</span>=<span class="string">"handleError"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:before-upload</span>=<span class="string">"handleBeforeUpload"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-progress</span>=<span class="string">"handleProgress"</span></span></span><br><span class="line"><span class="tag">&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">"primary"</span> <span class="attr">size</span>=<span class="string">"medium"</span>&gt;</span>上传图片<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">el-upload</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!--</span></span><br><span class="line"><span class="comment">  action: 图片上传的地址</span></span><br><span class="line"><span class="comment">  show-file-list: 是否显示文件上传列表</span></span><br><span class="line"><span class="comment">  accept: 可接受的上传类型，image/*为图片</span></span><br><span class="line"><span class="comment">  headers: 头部信息</span></span><br><span class="line"><span class="comment">  on-success: 上传成功事件</span></span><br><span class="line"><span class="comment">  on-error: 上传失败事件</span></span><br><span class="line"><span class="comment">  before-upload: 上传前处理事件，返回一个值，值为false将阻止上传</span></span><br><span class="line"><span class="comment">  on-progress: 上传中事件</span></span><br><span class="line"><span class="comment">  --&gt;</span></span><br></pre></td></tr></table></figure>

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*----- 以下为常用处理代码 ------*/</span></span><br><span class="line">handleSuccess(response, file, fileList) &#123;</span><br><span class="line">  <span class="keyword">this</span>.$success(<span class="string">"上传成功"</span>);</span><br><span class="line">&#125;,</span><br><span class="line">handleError() &#123;</span><br><span class="line">  <span class="keyword">this</span>.$error(<span class="string">"上传失败,请重新上传图片!"</span>);</span><br><span class="line">&#125;,</span><br><span class="line">handleBeforeUpload(file) &#123;</span><br><span class="line">  <span class="keyword">const</span> isImage = file.type.includes(<span class="string">"image"</span>);</span><br><span class="line">  <span class="keyword">if</span> (!isImage) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$message.error(<span class="string">"上传文件类型必须是图片!"</span>);</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">const</span> isLt2M = file.size / <span class="number">1024</span> / <span class="number">1024</span> &lt; <span class="number">2</span>;</span><br><span class="line">  <span class="keyword">if</span> (!isLt2M) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$message.error(<span class="string">"上传图片大小不能超过 2MB!"</span>);</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">return</span> isImage &amp;&amp; isLt2M;</span><br><span class="line">&#125;,</span><br><span class="line">handleProgress(event, file, fileList) &#123;</span><br><span class="line">  <span class="keyword">this</span>.loading = <span class="literal">true</span>;  <span class="comment">//  上传时执行loading事件</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="手动上传，一次提交多个-el-upload-的图片"><a href="#手动上传，一次提交多个-el-upload-的图片" class="headerlink" title="手动上传，一次提交多个 el-upload 的图片"></a>手动上传，一次提交多个 el-upload 的图片</h3><blockquote>
<p>要求：每个 picture area 限制选择一张图片，点击确定后一起提交。</p>
</blockquote>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">el-upload</span></span></span><br><span class="line"><span class="tag">  <span class="attr">action</span>=<span class="string">"myUrl"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-change</span>=<span class="string">"(file,fileList)=&gt;&#123;handleChange(file,fileList,1)&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-remove</span>=<span class="string">"(file,fileList)=&gt;&#123;handleRemove(file,fileList,1)&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:auto-upload</span>=<span class="string">"false"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:file-list</span>=<span class="string">"fileList[0]"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">ref</span>=<span class="string">"file1"</span></span></span><br><span class="line"><span class="tag">&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">size</span>=<span class="string">"small"</span>&gt;</span>选择图片<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">el-upload</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">el-upload</span></span></span><br><span class="line"><span class="tag">  <span class="attr">action</span>=<span class="string">"myUrl"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-change</span>=<span class="string">"(file,fileList)=&gt;&#123;handleChange(file,fileList,2)&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-remove</span>=<span class="string">"(file,fileList)=&gt;&#123;handleRemove(file,fileList,2)&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:auto-upload</span>=<span class="string">"false"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:file-list</span>=<span class="string">"fileList[1]"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">ref</span>=<span class="string">"file2"</span></span></span><br><span class="line"><span class="tag">&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">size</span>=<span class="string">"small"</span>&gt;</span>选择图片<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">el-upload</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">el-upload</span></span></span><br><span class="line"><span class="tag">  <span class="attr">action</span>=<span class="string">"myUrl"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-change</span>=<span class="string">"(file,fileList)=&gt;&#123;handleChange(file,fileList,3)&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:on-remove</span>=<span class="string">"(file,fileList)=&gt;&#123;handleRemove(file,fileList,3)&#125;"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:auto-upload</span>=<span class="string">"false"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">:file-list</span>=<span class="string">"fileList[2]"</span></span></span><br><span class="line"><span class="tag">  <span class="attr">ref</span>=<span class="string">"file3"</span></span></span><br><span class="line"><span class="tag">&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">size</span>=<span class="string">"small"</span>&gt;</span>选择图片<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">el-upload</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">el-button</span> @<span class="attr">click</span>=<span class="string">"submitData"</span>&gt;</span>确认<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!--</span></span><br><span class="line"><span class="comment">  action:提交的地址，此处随便写一个，不写会报错</span></span><br><span class="line"><span class="comment">  on-change: 图片上传到缓存中将被触发</span></span><br><span class="line"><span class="comment">  on-remove: 从缓存中删除文件将被触发</span></span><br><span class="line"><span class="comment">  --&gt;</span></span><br></pre></td></tr></table></figure>

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br></pre></td><td class="code"><pre><span class="line">data()&#123;</span><br><span class="line">  fileList: [<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>], <span class="comment">//缓存区文件</span></span><br><span class="line">  uploadFile:[[],[],[]] <span class="comment">//  上传用文件</span></span><br><span class="line">&#125;,</span><br><span class="line">handleChange(file, fileList, type) &#123;</span><br><span class="line">  <span class="comment">//  限制单张上传，超过限制即覆盖</span></span><br><span class="line">  <span class="keyword">if</span> (fileList.length &gt; <span class="number">1</span>) &#123;</span><br><span class="line">    fileList.splice(<span class="number">0</span>, <span class="number">1</span>);</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">//  校验</span></span><br><span class="line">  <span class="keyword">const</span> isLt2M = file.size / <span class="number">1024</span> / <span class="number">1024</span> &lt; <span class="number">5</span>;</span><br><span class="line">  <span class="keyword">if</span> (!isLt2M) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$message.error(<span class="string">"上传图片大小不能超过 5MB!"</span>);</span><br><span class="line">    <span class="keyword">this</span>.removeUploadedFile(type);  <span class="comment">//  不符合要求删除文件</span></span><br><span class="line">    <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="keyword">const</span> isImage = file.raw.type.includes(<span class="string">"image"</span>);</span><br><span class="line">  <span class="keyword">if</span> (!isImage) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$message.error(<span class="string">"上传的格式必须是图片!"</span>);</span><br><span class="line">    <span class="keyword">this</span>.removeUploadedFile(type);</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="comment">//  验证通过之后，将缓存区文件存入上传区文件中</span></span><br><span class="line">  <span class="keyword">this</span>.formData.files[type] = file.raw;</span><br><span class="line">&#125;,</span><br><span class="line"><span class="comment">//  从缓存区移除文件</span></span><br><span class="line">removeUploadedFile(type) &#123;</span><br><span class="line">  <span class="keyword">if</span> (type === <span class="number">0</span>) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$refs.file1.clearFiles();</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (type === <span class="number">1</span>) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$refs.file2.clearFiles();</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (type === <span class="number">2</span>) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$refs.file3.clearFiles();</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//  删除文件</span></span><br><span class="line">handleRemove(file, fileList, type) &#123;</span><br><span class="line">  <span class="comment">//  删除文件时要移除缓存区文件和上传区文件</span></span><br><span class="line">  <span class="keyword">this</span>.fileList[type] = <span class="number">0</span>;</span><br><span class="line">  <span class="keyword">this</span>.uploadFile[type] = [];</span><br><span class="line">&#125;,</span><br><span class="line"><span class="comment">//  上传文件</span></span><br><span class="line">submitData() &#123;</span><br><span class="line">  <span class="comment">//  校验是否选择文件</span></span><br><span class="line">  <span class="keyword">let</span> fileNum = <span class="keyword">this</span>.flatten(<span class="keyword">this</span>.uploadFile).length;</span><br><span class="line">  <span class="keyword">if</span> (fileNum === <span class="number">0</span>) &#123;</span><br><span class="line">    <span class="keyword">this</span>.$error(<span class="string">"未选择任何文件!"</span>);</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">//  使用formdata格式</span></span><br><span class="line">  <span class="keyword">let</span> formData = <span class="keyword">new</span> FormData();</span><br><span class="line">  <span class="keyword">if</span> (<span class="keyword">this</span>.formData.files[<span class="number">0</span>]) &#123;</span><br><span class="line">    formData.append(<span class="string">"file1"</span>, <span class="keyword">this</span>.formData.files[<span class="number">0</span>]);</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (<span class="keyword">this</span>.formData.files[<span class="number">1</span>]) &#123;</span><br><span class="line">    formData.append(<span class="string">"file2"</span>, <span class="keyword">this</span>.formData.files[<span class="number">1</span>]);</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">if</span> (<span class="keyword">this</span>.formData.files[<span class="number">2</span>]) &#123;</span><br><span class="line">    formData.append(<span class="string">"file2"</span>, <span class="keyword">this</span>.formData.files[<span class="number">2</span>]);</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">  <span class="comment">//  请求:在headers上务必加上content-Type,指定表单形式发送</span></span><br><span class="line">  axios</span><br><span class="line">  .post(<span class="string">"uploadUrl"</span>, formData, &#123;<span class="attr">headers</span>: &#123; <span class="string">"Content-Type"</span>: <span class="string">"multipart/form-data"</span> &#125;&#125;)</span><br><span class="line">  .then(<span class="function"><span class="params">res</span> =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">this</span>.$success(<span class="string">"上传图片成功!"</span>);</span><br><span class="line">    <span class="keyword">this</span>.fileList = [<span class="number">0</span>,<span class="number">0</span>,<span class="number">0</span>];</span><br><span class="line">    <span class="keyword">this</span>.uploadFile =[[],[],[]];</span><br><span class="line">  &#125;)</span><br><span class="line">  .catch(<span class="function"><span class="params">e</span> =&gt;</span> &#123;</span><br><span class="line">    <span class="built_in">console</span>.log(e);</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//  扁平化数组</span></span><br><span class="line">flatten(arr) &#123;</span><br><span class="line">  <span class="keyword">let</span> res = [];</span><br><span class="line">  <span class="keyword">for</span> (<span class="keyword">let</span> i = <span class="number">0</span>; i &lt; arr.length; i++) &#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="built_in">Array</span>.isArray(arr[i])) &#123;</span><br><span class="line">      res = res.concat(<span class="keyword">this</span>.flatten(arr[i]));</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">      res.push(arr[i]);</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">return</span> res;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p><a href="https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types#multipartform-data" target="_blank" rel="noopener">multipartform-data 相关知识</a></p>
<h2 id="图片加载技术：预加载和懒加载"><a href="#图片加载技术：预加载和懒加载" class="headerlink" title="图片加载技术：预加载和懒加载"></a>图片加载技术：预加载和懒加载</h2><ul>
<li>预加载：重点在”预”，在用户需要看到该图片之前，就已经加载和请求到该图片。</li>
<li>懒加载: 重点在”懒”，尽可能少的加载图片，只加载必需的图片（用户屏幕可视范围内）,目的是尽可能的减少请求数，减缓服务器的压力。<br>在 vue 中懒加载的组件有很多，比如<code>vue-lazy-laod</code>和<code>vue-clazy-load</code></li>
</ul>
<h2 id="浏览器阻塞"><a href="#浏览器阻塞" class="headerlink" title="浏览器阻塞"></a>浏览器阻塞</h2><blockquote>
<p>同一时间对服务器的请求过多，将会造成浏览器阻塞。<br>浏览器默认对同一域下的资源，只保持一定的连接数，阻塞过多的连接,以提高访问速度和解决阻塞问题。</p>
</blockquote>
<p>对于请求图片来说，有以下解决方法</p>
<ol>
<li>使用雪碧图：把所有图片合成一张大图。</li>
<li>延迟加载：只去请求可视区的图片。<br>最后使用了延迟加载,对非可视区领域的图片延迟加载，优先加载可视区图片，减少图片的请求数。</li>
</ol>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">img</span> <span class="attr">:src</span>=<span class="string">"imageUrl"</span> <span class="attr">ref</span>=<span class="string">"img"</span> /&gt;</span></span><br></pre></td></tr></table></figure>

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//  方式一:延迟加载非可视区域</span></span><br><span class="line">delayTime() &#123;</span><br><span class="line">  <span class="keyword">let</span> windowHeight = <span class="built_in">window</span>.innerHeight;</span><br><span class="line">  <span class="keyword">let</span> imgTop = <span class="keyword">this</span>.$refs.img.getBoundingClientRect().top;</span><br><span class="line">  <span class="keyword">const</span> isDelay = imgTop &gt; windowHeight;</span><br><span class="line">  <span class="keyword">if</span> (isDelay) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="built_in">Math</span>.random() * <span class="number">2000</span> + <span class="number">3000</span>;</span><br><span class="line">  &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="built_in">Math</span>.random() * <span class="number">2000</span> + <span class="number">500</span>;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//  方法二:按顺序依次延迟加载</span></span><br><span class="line">delayTime() &#123;</span><br><span class="line">  <span class="keyword">if</span> (<span class="keyword">this</span>.params.index) &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="built_in">Math</span>.random() * <span class="number">2000</span> + <span class="keyword">this</span>.params.index * <span class="keyword">this</span>.params.type * <span class="number">500</span>;</span><br><span class="line">  &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">setTimeout(<span class="function"><span class="params">()</span> =&gt;</span> &#123;</span><br><span class="line">  <span class="comment">//  图片请求代码</span></span><br><span class="line">&#125;, <span class="keyword">this</span>.delayTime);</span><br></pre></td></tr></table></figure>

<p><strong>使用延时加载前的请求</strong><br><img src="http://ytju2r.coding-pages.com/%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD%E5%89%8D.png" alt="使用延时加载前的请求"></p>
<p><strong>使用延时加载后的请求</strong><br><img src="http://ytju2r.coding-pages.com/%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD%E5%90%8E.png" alt="使用延时记载后的请求"></p>
<h2 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h2><p>[1]<a href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" target="_blank" rel="noopener">xmlhttprequest standard.the responsetype attribute</a><br>[2]<a href="https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest/responseType" target="_blank" rel="noopener">xmlhttprequest.responsetype | mdn</a><br>[3]<a href="https://www.zhangxinxu.com/wordpress/2013/10/understand-domstring-document-formdata-blob-file-arraybuffer/" target="_blank" rel="noopener">理解domstring、document、formdata、blob、file、arraybuffer数据类型 « 张鑫旭-鑫空间-鑫生活</a><br>[4]<a href="https://developer.mozilla.org/zh-CN/docs/Web/API/FormData/Using_FormData_Objects" target="_blank" rel="noopener">formdata 对象的使用 | mdn</a><br>[5]<a href="https://blog.csdn.net/u012496505/article/details/73824327" target="_blank" rel="noopener">前端|加载的图片太多或者太大怎么办(上) - u012496505的博客 - csdn博客</a><br>[6]<a href="https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/" target="_blank" rel="noopener">lazy loading images and video | web fundamentals | google developers</a><br>[7]<a href="https://cloudinary.com/blog/an_introduction_to_progressive_image_rendering" target="_blank" rel="noopener">an introduction to progressive image rendering</a><br>[8]<a href="http://web.jobbole.com/92265/?utm_source=blog.jobbole.com&utm_medium=relatedPosts" target="_blank" rel="noopener">原生 js 实现最简单的图片懒加载 - web前端 - 伯乐在线</a></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/Blog/tags/vue/" rel="tag"># vue</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/Blog/2019/01/14/git%E6%8F%90%E4%BA%A4%E4%BF%A1%E6%81%AF/" rel="prev" title="git提交信息">
                git提交信息 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">jingping.ye</p>
              <p class="site-description motion-element" itemprop="description">jingping.ye的Blog|文章</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/Blog/archives/">
              
                  <span class="site-state-item-count">19</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/Blog/categories/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/Blog/tags/index.html">
                  <span class="site-state-item-count">22</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/yourname" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:yourname@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://plus.google.com/yourname" target="_blank" title="Google">
                      
                        <i class="fa fa-fw fa-google"></i>Google</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://twitter.com/yourname" target="_blank" title="Twitter">
                      
                        <i class="fa fa-fw fa-twitter"></i>Twitter</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.facebook.com/yourname" target="_blank" title="FB Page">
                      
                        <i class="fa fa-fw fa-facebook"></i>FB Page</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://vk.com/yourname" target="_blank" title="VK Group">
                      
                        <i class="fa fa-fw fa-vk"></i>VK Group</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://stackoverflow.com/yourname" target="_blank" title="StackOverflow">
                      
                        <i class="fa fa-fw fa-stack-overflow"></i>StackOverflow</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://youtube.com/yourname" target="_blank" title="YouTube">
                      
                        <i class="fa fa-fw fa-youtube"></i>YouTube</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://instagram.com/yourname" target="_blank" title="Instagram">
                      
                        <i class="fa fa-fw fa-instagram"></i>Instagram</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="skype:yourname?call|chat" target="_blank" title="Skype">
                      
                        <i class="fa fa-fw fa-skype"></i>Skype</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#vue-中对图片的处理"><span class="nav-number">1.</span> <span class="nav-text">vue 中对图片的处理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#请求图片"><span class="nav-number">1.1.</span> <span class="nav-text">请求图片</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#显示图片"><span class="nav-number">1.2.</span> <span class="nav-text">显示图片</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#上传图片-使用-element-ui-的-el-upload"><span class="nav-number">1.3.</span> <span class="nav-text">上传图片:使用 element-ui 的 el-upload</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#自动上传，一次传一张图片"><span class="nav-number">1.3.1.</span> <span class="nav-text">自动上传，一次传一张图片</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#手动上传，一次提交多个-el-upload-的图片"><span class="nav-number">1.3.2.</span> <span class="nav-text">手动上传，一次提交多个 el-upload 的图片</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#图片加载技术：预加载和懒加载"><span class="nav-number">1.4.</span> <span class="nav-text">图片加载技术：预加载和懒加载</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#浏览器阻塞"><span class="nav-number">1.5.</span> <span class="nav-text">浏览器阻塞</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#参考"><span class="nav-number">1.6.</span> <span class="nav-text">参考</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">jingping.ye</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">Site words total count&#58;</span>
    
    <span title="Site words total count">15k</span>
  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/Blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/Blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/Blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/Blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/Blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/Blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/Blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/Blog/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/Blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/Blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/Blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
